#include"../../common/httplib.h"

class HelloServer
{

public:
    HelloServer(int port) : _port(port)
    {
        _server.Get("/hi", std::bind(
                               &HelloServer::HelloWorld, this,
                               std::placeholders::_1,
                               std::placeholders::_2));
    }
    void run()
    {
        _server.listen("0.0.0.0", _port);
    }

public:
    void HelloWorld(const httplib::Request &req,
                    httplib::Response &rsp)
    {
        std::string body = "<h1>HelloWorld</h1>";
        rsp.set_content(body, "text/html");
        rsp.status = 200;
    }

private:
    int _port;
    httplib::Server _server;
};
int main()
{
    HelloServer server(8989);
    server.run();
    return 0;
}